package com.jlf.sample.auto.generate.server.impl;

import com.jlf.core.annotation.server.add.AddAfterProcessor;
import com.jlf.core.annotation.server.add.AddPostProcessor;
import com.jlf.core.annotation.server.add.AddPreProcessor;
import com.jlf.core.annotation.server.delete.DeleteAfterProcessor;
import com.jlf.core.annotation.server.delete.DeletePostProcessor;
import com.jlf.core.annotation.server.delete.DeletePreProcessor;
import com.jlf.core.annotation.server.edit.EditAfterProcessor;
import com.jlf.core.annotation.server.edit.EditPostProcessor;
import com.jlf.core.annotation.server.edit.EditPreProcessor;
import com.jlf.core.server.entity.AddRecordWrapper;
import com.jlf.core.server.entity.DeleteRecordWrapper;
import com.jlf.core.server.entity.ListWrapper;
import com.jlf.core.server.entity.Q;
import com.jlf.core.server.impl._SimpleServerImpl;
import com.jlf.sample.auto.generate.domain.Sample1DO;
import com.jlf.sample.auto.generate.entity.AddSample1Wrapper;
import com.jlf.sample.auto.generate.entity.EditSampleWrapper;
import com.jlf.sample.auto.generate.persistence.Sample1Persistence;
import com.jlf.sample.auto.generate.server.Sample1Server;
import lombok.extern.slf4j.Slf4j;

/**
 * 文件注释
 *
 * @author wujr
 * 2023/7/20
 * @version 1.0
 * 【变更历史】
 * [wujr 2023/7/20 1.0 新增]
 */
@Slf4j
public class Sample1ServerImpl extends _SimpleServerImpl<Sample1DO> implements Sample1Server {
    public Sample1ServerImpl(Sample1Persistence persistence) {
        super(persistence);
    }

    @Override
    public Sample1DO add(Sample1DO record) throws Exception{
        return super.add(record);
    }

    @Override
    public void add(AddRecordWrapper<Sample1DO> wrapper) throws Exception {
        super.add(wrapper);
    }

    @Override
    public ListWrapper<Sample1DO> query(Q<Sample1DO> input, Integer pageNo, Integer pageSize){
        return super.query(input, pageNo, pageSize);
    }

    @AddPreProcessor(order = 1)
    public void addCheck1(Sample1DO record) throws Exception{
        log.info("addCheck1");
    }
    @AddPreProcessor(order = 1)
    public void addCheck2(AddSample1Wrapper wrapper) throws Exception{
        log.info("addCheck2 with wrapper");
    }
    @AddPostProcessor(order = 1)
    public void addPost1(Sample1DO record) throws Exception{
        log.info("addPost1");
    }
    @AddPostProcessor(order = 2)
    public void addPost2(AddSample1Wrapper wrapper) throws Exception{
        log.info("addPost2 with wrapper");
    }
    @AddAfterProcessor(order = 1)
    public void addAfter1(Sample1DO record, boolean result){
        log.info("addAfter1");
    }
    @AddAfterProcessor(order = 1)
    public void addAfter2(AddSample1Wrapper wrapper, boolean result){
        log.info("addAfter2 with wrapper");
    }

    @EditPreProcessor(order = 1)
    public void editCheck1(Sample1DO original, Sample1DO record) throws Exception{
        log.info("editCheck1");
    }
    @EditPreProcessor(order = 1)
    public void editCheck2(EditSampleWrapper wrapper) throws Exception{
        log.info("editCheck2 with wrapper");
    }
    @EditPostProcessor(order = 1)
    public void editPost1(Sample1DO original, Sample1DO record) throws Exception{
        log.info("editPost1");
    }
    @EditPostProcessor(order = 1)
    public void editPost2(EditSampleWrapper wrapper) throws Exception{
        log.info("editPost2 with wrapper");
    }
    @EditAfterProcessor(order = 1)
    public void editAfter1(Sample1DO original, Sample1DO record, boolean result){
        log.info("editAfter1");
    }
    @EditAfterProcessor(order = 1)
    public void editAfter2(EditSampleWrapper wrapper, boolean result){
        log.info("editAfter2 with wrapper");
    }

    @DeletePreProcessor(order = 1)
    public void deleteCheck1(Sample1DO record) throws Exception{
        log.info("deleteCheck1");
    }
    @DeletePreProcessor(order = 1)
    public void deleteCheck2(DeleteRecordWrapper<Sample1DO> wrapper) throws Exception{
        log.info("deleteCheck2 with wrapper");
    }
    @DeletePostProcessor(order = 1)
    public void deletePost1(Sample1DO record) throws Exception{
        log.info("deletePost1");
    }
    @DeletePostProcessor(order = 1)
    public void deletePost2(DeleteRecordWrapper<Sample1DO> wrapper) throws Exception{
        log.info("deletePost2 with wrapper");
    }
    @DeleteAfterProcessor(order = 1)
    public void deleteAfter1(Sample1DO record, boolean result){
        log.info("deleteAfter1");
    }
    @DeleteAfterProcessor(order = 1)
    public void deleteAfter2(DeleteRecordWrapper<Sample1DO> wrapper, boolean result){
        log.info("deleteAfter2 with wrapper");
    }
}
